<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1">
    <title></title>
    <link rel="stylesheet" href="../frame/layui/css/layui.css">
    <link rel="stylesheet" href="../frame/static/css/style.css">
    <link rel="icon" href="../frame/static/image/code.png">
    <style type="text/css">
    </style>
</head>
<body class="body">
    	<form class="layui-form" action="">
        <button type="button" class="layui-btn layui-btn-normal layui-btn-sm">选择租车的型号：</button><br/><br/>
    	  <div class="layui-form-item">
		      <select name="interest" lay-filter="aihao">
		        <option value=""></option>
		        <option value="0">A</option>
		        <option value="1">B</option>
		        <option value="2">C</option>
		        <option value="3">D</option>
		      </select>
		  </div>
    	<button type="button" class="layui-btn layui-btn-normal layui-btn-sm">选择租车的条件：</button><br/><br/>
          <div class="layui-form-item">
		    <div class="layui-input-inline">
		      <select name="quiz1">
		        <option value="">请选择品牌</option>
		        <option value="">一汽重汽</option>
		        <option value="">江淮</option>
		        <option value="">五征</option>
		      </select>
		     </div>
		     <div class="layui-input-inline">
		      <select name="quiz2">
		        <option value="">请选择里程</option>
		        <option value="">不限</option>
		        <option value="">0KM--10KM</option>
		        <option value="">10KM--100KM</option>
		        <option value="">100KM--1000KM</option>
		        <option value="">1000KM以上</option>
		      </select>
			</div></div>
			<div class="layui-form-item">
		     <div class="layui-input-inline">
		      <select name="quiz3">
		        <option value="">请选择容积</option>
		        <option value="">不限</option>
		        <option value="">40立方--50立方</option>
		        <option value="">50立方--60立方</option>
		        <option value="">60立方--70立方</option>
		        <option value="">70立方以上</option>
		      </select>
		      </div>
		     <div class="layui-input-inline">
		      <select name="quiz4">
		        <option value="">请选择价格</option>
		        <option value="">不限</option>
		        <option value="">0万--10万</option>
		        <option value="">20万--30万</option>
		        <option value="">30万--40万</option>
		        <option value="">40万以上</option>
		      </select>
		    </div>
		  </div>
		  	<div class="layui-upload">
			  <button type="button" class="layui-btn layui-btn-normal layui-btn-sm" id="test1">上传展示图片：</button>
			  <div class="layui-upload-list">
			    <img style="width:90px;height:70px;"  class="layui-upload-img" id="demo1">
			    <p id="demoText"></p>
			  </div>
			</div> 
		  	<div class="layui-upload">
			  <button type="button" class="layui-btn layui-btn-normal layui-btn-sm" id="test2">上传轮播图片：</button> 
			  <blockquote class="layui-elem-quote layui-quote-nm" style="margin-top: 10px;">
			    <div class="layui-upload-list" id="demo2"></div>
			 </blockquote>
			</div>
			  <div class="layui-form-item" style="float: right;">
			    <div class="layui-input-block">
			      <button class="layui-btn layui-btn-normal">立即提交</button>
			      <button type="reset" class="layui-btn layui-btn-primary">重置</button>
			    </div>
			  </div>
		  </form>
<script type="text/javascript" src="../frame/layui/layui.all.js"></script>
<script>
layui.use('upload', function(){
  var $ = layui.jquery
  ,upload = layui.upload;
  
  //普通图片上传
  var uploadInst = upload.render({
    elem: '#test1'
    ,url: '/upload/'
    ,before: function(obj){
      //预读本地文件示例，不支持ie8
      obj.preview(function(index, file, result){
        $('#demo1').attr('src', result); //图片链接（base64）
      });
    }
    ,done: function(res){
      //如果上传失败
      if(res.code > 0){
        return layer.msg('上传失败');
      }
      //上传成功
    }
    ,error: function(){
      //演示失败状态，并实现重传
      var demoText = $('#demoText');
      demoText.html('<span style="color: #FF5722;">上传失败</span> <a class="layui-btn layui-btn-xs demo-reload">重试</a>');
      demoText.find('.demo-reload').on('click', function(){
        uploadInst.upload();
      });
    }
  });
  
  //多图片上传
  upload.render({
    elem: '#test2'
    ,url: '/upload/'
    ,multiple: true
    ,before: function(obj){
      //预读本地文件示例，不支持ie8
      obj.preview(function(index, file, result){
        $('#demo2').append('<img style="width:100px;height: 70px;" src="'+ result +'" alt="'+ file.name +'" class="layui-upload-img">')
      });
    }
    ,done: function(res){
      //上传完毕
    }
  });
  
  
  
});
</script>
</body>
</html>